//
// Created by Axe on 2024/3/12.
//

#include "Student.h"
#include <cstring>
#include "log.h"

/**
 * 构造函数实现
 */
Student::Student() {
    this->age = 10;
    this->name = "峰哥";
}

/**
 * 获取年龄实现
 * @return age
 */
int Student::getAge() const {
    return this->age;
}

/**
 * 带参数的的构造函数
 *
 * @param age 年龄
 * @param name 名字
 * @param hobby hobby
 * @param allInt allInt
 * @param score score
 */
Student::Student(int age, std::string name, std::string *hobby, std::list<int> allInt,
                 std::map<int, std::string> score) {
    // 赋值age
    this->age = age;

    // 赋值name
    this->name = name;

    // 赋值hobby
    for (int i = 0; i < hobby->size(); ++i) {
        this->hobby[i] = hobby[i];
    }

    // 赋值list
    this->allInt = allInt;

    this->score = score;
}

std::string Student::getName() const {
    return this->name;
}

std::string *Student::getHobby() {
    return this->hobby;
}

std::list<int> Student::getAllint() {
    return this->allInt;
}

std::map<int, std::string> Student::getAllSocre() {
    return this->score;
}

std::vector<std::string> Student::getOtherStr() {
    return this->otherStr;
}

void Student::setOtherStr(std::vector<std::string> otherStr) {
    this->otherStr.assign(otherStr.begin(), otherStr.end());
}

void Student::addOtherStr(std::string newStr) {
    this->otherStr.push_back(newStr);
}

Student::~Student() {
    // 释放资源
    LOGI("析构函数被调用");
}
